<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>
<div id="app">
  <button @click="increase">按钮</button>
  <span>{{count}}</span>
</div>
<script type="module">
import {createApp, ref} from './node_modules/vue/dist/vue.esm-browser.js'

function useCount() {
  const count = ref(0) // 将基本类型数据转化成响应式对象
  return {
    count,
    increase: () => {
      count.value++
    }
  }
}

createApp({
  setup() {
    return {
      ...useCount()
    }
  }
}).mount('#app')
</script>
</body>
</html>
